home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: Need Unique ID generation
- Date: Fri, 01 Mar 1996 17:12:27 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4h7b4k$837@news.halcyon.com>
- References: <4h3vmq$4a6@alpha.it.net> <31369697.249D@symantec.com>
- NNTP-Posting-Host: blv-pm10-ip9.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Walter Bright <wbright@symantec.com> wrote:
-
- >Antonio Romeo wrote:
- >> I need a Unique Identifier generation routine on multiple machines.
- >> The identifier must be a 32bit long (unsigned long int) number.
-
- >I believe Microsoft solved this problem by melding in the network card
- >address with the time of day.
-
- Yes, they did. GUIDs. These are 128-bit structs practically certain
- to be unique.
-
- To create them programatically, look up
-
- CoInitialize()
- CoCreateGuid()
-
- You can also generate them off-line with the guidgen.exe
- then use them in your programs. To use GUIDs made before-hand, lookup
-
- DEFINE_GUID() // a macro in basetyps.h?
-
- Because they're structs, DEFINE_GUID has two flavors, one declares a
- variable of the GUID type, the other defines the variable and
- initializes the structure with all the values. You need to #define
- INITGUID before the DEFINE_GUIDs and, I think, #include<initguid.h>
- together in one and only one of the source-files of your project.
-
- Hope this helps.
- --Norm
-
-